﻿using System;

namespace TrinityAPI.Base
{
    public interface ICache
    {
        /// <summary>
        /// 获取缓存数据
        /// </summary>
        /// <param name="key">键</param>
        /// <returns></returns>
        object Get(string key);

        /// <summary>
        /// 设置缓存数据
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        void Set(string key, object value);

        /// <summary>
        /// 设置缓存数据
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <param name="timeout">过期时间（单位：秒）</param>
        void Set(string key, object value, int timeout);

        /// <summary>
        /// 异常缓存数据
        /// </summary>
        /// <param name="key">键</param>
        void Remove(string key);

        /// <summary>
        /// 清除所有缓存数据
        /// </summary>
        void RemoveAll();
    }
}
